var isIE = (document.all) ? true : false;
var getEvent = function(evt) {
	return evt ? evt : (window.event ? window.event : null);
};
var _x, _y, _cx, _cy;
var oDragObj;
function mouseDown(event) {
	e = getEvent(event);
	var srcElement = e.srcElement || e.target;
	if (srcElement.id == "mapDiv") {
		_x = parseInt(e.clientX);
		_y = parseInt(e.clientY);
		_cx = parseInt(srcElement.style.left);
		_cy = parseInt(srcElement.style.top);
		oDragObj = srcElement;
		document.onmousemove = mouseMove;
		return false;
	}
	return false;
}
function mouseMove(event) {
	e = getEvent(event);
	oDragObj.style.left = parseInt(_cx + e.clientX - _x) + "px";
	oDragObj.style.top = parseInt(_cy + e.clientY - _y) + "px";
	return false;
}
function mouseUp(event) {
	document.onmousemove = null;
}
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;

function initDivWidth() {
	if (document.uniqueID) {
		mapDx = parseInt(window.screen.width) - 22;
		mapDy = parseInt(window.screen.height) - 45;
	} else {
		mapDx = parseInt(window.screen.width) - 27;
		mapDy = parseInt(window.screen.height)  - 40;
	}
	getId('mainDiv').style.width =mapDx+"px";
	getId('mainDiv').style.height =mapDy+"px";
};
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
};
addLoadEvent(initDivWidth);
window.onresize = function() {
	initDivWidth();
}
